package test.rabbitmq

import com.rabbitmq.client.Channel
import com.rabbitmq.client.Connection
import com.rabbitmq.client.ConnectionFactory
import org.junit.jupiter.api.Test

class RabbitmqTest {

    @Test
    fun `connect`() {
        // 创建连接工厂
        val factory = ConnectionFactory()
        factory.host = "192.168.18.125"
        factory.port = 5674
        factory.username = "tsUserName"
        factory.password = "tsUserName123"

        // 创建连接
        val connection: Connection = factory.newConnection()
        // 创建通道
        val channel: Channel = connection.createChannel()
        // 关闭连接和通道
        channel.close()
        connection.close()
    }

}